import request from './request'
// 获取角色列表
export const userRoleList = () => {
  return request({
    url: '/user/roleList',
    method: 'get',
    headers: {
      isToken: true,
      repeatSubmit: false
    }
  })
}

// 添加用户
export const userAdd = (user) => {
  return request({
    url: '/user/add',
    method: 'post',
    data: user,
    headers: {
      isToken: true,
      repeatSubmit: false
    }
  })
}

// 用户列表
export const userList = (params) => {
  return request({
    url: '/user/list',
    method: 'get',
    param: params,
    headers: {
      isToken: true,
      repeatSubmit: false
    }
  })
}

// 删除用户
export const userDelete = (userId) => {
  return request({
    url: '/user/delete',
    method: 'get',
    param: { userId },
    headers: {
      isToken: true,
      repeatSubmit: false
    }
  })
}

// 修改用户
export const userUpdate = (role) => {
  return request({
    url: '/user/update',
    method: 'post',
    data: role,
    headers: {
      isToken: true,
      repeatSubmit: false
    }
  })
}

// 用户详情
export const userDetail = (userId) => {
  return request({
    url: '/user/detail',
    method: 'get',
    param: { userId },
    headers: {
      isToken: true,
      repeatSubmit: false
    }
  })
}
